home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / other / mesa / mesa-glut / src-glut.aos / glutstrokewidth.c < prev    next >
C/C++ Source or Header  |  2000-02-23  |  986b  |  49 lines

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1995. */
  3.  
  4. /* This program is freely distributable without licensing fees 
  5.    and is provided without guarantee or warrantee expressed or 
  6.    implied. This program is -not- in the public domain. */
  7.  
  8. #include "glutstuff.h"
  9. #include "glutStroke.h"
  10.  
  11. /* CENTRY */
  12. int glutStrokeWidth(GLUTstrokeFont font, int c)
  13. {
  14.   StrokeFontPtr fontinfo;
  15.   const StrokeCharRec *ch;
  16.  
  17.   fontinfo = (StrokeFontPtr) font;
  18.  
  19.   if (c < 0 || c >= fontinfo->num_chars)
  20.     return 0;
  21.   ch = &(fontinfo->ch[c]);
  22.   if (ch)
  23.     return ch->right;
  24.   else
  25.     return 0;
  26. }
  27.  
  28. int glutStrokeLength(GLUTstrokeFont font, const unsigned char *string)
  29. {
  30.   int c, length;
  31.   StrokeFontPtr fontinfo;
  32.   const StrokeCharRec *ch;
  33.  
  34.   fontinfo = (StrokeFontPtr) font;
  35.  
  36.   length = 0;
  37.   for (; *string != '\0'; string++) {
  38.     c = *string;
  39.     if (c >= 0 && c < fontinfo->num_chars) {
  40.       ch = &(fontinfo->ch[c]);
  41.       if (ch)
  42.         length += ch->right;
  43.     }
  44.   }
  45.   return length;
  46. }
  47.  
  48. /* ENDCENTRY */
  49.